<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        /**
        * @param {string} s
        * @return {boolean}
        */
        var isValid = function (s) {
            let stack = []
            let m = s.length
            let i=0
            while(i<m){
                if(s[i]==='['||s[i]==='{'||s[i]==='('){
                    stack.push(s[i])
                    i++
                }else{
                    let left = stack.pop()
                    if((left === '{'&&s[i]==='}')||(left==='['&&s[i]===']')||(left==='('&&s[i]===')')){
                        i++
                    }else{
                        return false
                    }
                }
            }
            if (stack.length) return false
            return true
        };
        console.log(isValid('{{[[(([[]]))()]])}}'))
    </script>
</body>

</html>